using System;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Transformable_Engine_v2.Engine.Graphics
{
    public abstract class SpriteSheetInstance
    {
        public abstract string SpriteSheetPath { get; }

        protected abstract void LoadSprites();

        protected SpriteSheetInstance()
        {
            if(SpriteSheet.AddTexture(SpriteSheetPath))
                LoadSprites();
        }

        public void AddSprite(Enum textureName, TE_Rectangle textureArea)
        {
            SpriteSheet.AddSprite(SpriteSheetPath, textureName, textureArea);
        }

        public Sprite GetSprite(Enum textureName)
        {
            return SpriteSheet.GetSprite(SpriteSheetPath, textureName);
        }

        public Sprite GetSpriteAlphabet<T>(string letter)
        {
            return SpriteSheet.GetSpriteAlphabet<T>(SpriteSheetPath, letter);
        }

        public void AddEnumList<T>(Enum startValue, Enum endValue, TE_Rectangle startPosition, int frameWidth)
        {
            SpriteSheet.AddEnumList<T>(SpriteSheetPath, startValue, endValue, startPosition, frameWidth);
        }

        public void AddEnumList<T>(Enum startValue, Enum endValue, TE_Rectangle startPosition, SpriteSheet.AddEnumOrientation orientation = SpriteSheet.AddEnumOrientation.Horizontal)
        {
            SpriteSheet.AddEnumList<T>(SpriteSheetPath, startValue, endValue, startPosition, orientation);
        }
    }
}